#ifndef __BUILDER_H__
#define __BUILDER_H__
#include <iostream>
#include <string>
#include <memory>

class Computer{
public:
    void setCPU(const std::string& cpu){
        m_cpu = cpu;
    }
    void setRAM(const std::string& ram){
        m_ram = ram;
    }
    void setStorage(const std::string& storage){
        m_storage = storage;
    }
    void show(){
        std::cout << "cpu: " << m_cpu
        << "\nram: " << m_ram
        << "\nstorage: " << m_storage
        << std::endl;
    }
private:
    std::string m_cpu;
    std::string m_ram;
    std::string m_storage;

};

class ComputerBuilder{
public:
    
    std::shared_ptr<Computer> GetComputer(){
        return m_computer;
    };
    virtual void buildCPU() = 0;
    virtual void buildRAM() = 0;
    virtual void buildStorage() = 0;


protected:
    std::shared_ptr<Computer> m_computer;
};


class GameCoumputerBuiler : public ComputerBuilder{
public:
    GameCoumputerBuiler();
    ~GameCoumputerBuiler() = default;
    virtual void buildCPU();
    virtual void buildRAM();
    virtual void buildStorage();
};

class WorkCoumputerBuiler : public ComputerBuilder{
public:
    WorkCoumputerBuiler();
    ~WorkCoumputerBuiler() = default;
    virtual void buildCPU();
    virtual void buildRAM();
    virtual void buildStorage();
};

class Director{
public:
    std::unique_ptr<ComputerBuilder> Construct(std::unique_ptr<ComputerBuilder> builder){
        builder->buildCPU();   
        builder->buildRAM();
        builder->buildStorage();
        return builder;
    }
};

#endif